package lab02.test32;

import java.util.HashMap;
import java.util.Map;

public class Test {

    public static void main(String[] args) {

        Map<String,String> person= new HashMap<>();

        person.put("id","1");
        person.put("name","张三");
        person.put("gender","男");
        person.put("age","25");
        person.put("love","爱学Java");

        // 遍历这个map
        for(Map.Entry<String,String> entry : person.entrySet()){

            System.out.println(entry.getKey()+", "+entry.getValue());
        }

        System.out.println("map集合的大小是" +person.size());
        // 删除key为age的记录
        for(Map.Entry<String,String>entry :person.entrySet()){
            if(entry.getKey().equals("age")){
                person.remove(entry.getKey());
            }
        }
        System.out.println("map的集合大小是："+person.size());
    }
}
